package com.cqupt.tr.ttuauth.service.impl;

import com.cqupt.tr.bean.BaseMessage;
import com.cqupt.tr.bean.pojo.TTU;
import com.cqupt.tr.ttuauth.mapper.TTUAuthMapper;
import com.cqupt.tr.ttuauth.service.TTUAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TTUAuthServiceImpl implements TTUAuthService {


    @Autowired
    private TTUAuthMapper ttuAuthMapper;

    @Override
    public BaseMessage addNewTTU(TTU ttu) {
        BaseMessage baseMessage = new BaseMessage();
        try {
            ttuAuthMapper.insert(ttu);
            baseMessage.setData(ttu);
            baseMessage.setCode("0");
            baseMessage.setMsg("success insert");
        }catch (Exception e){
            e.printStackTrace();
            baseMessage.setCode("1");
            baseMessage.setMsg("fail to insert");
        }
        return baseMessage;
    }
}
